package ru.beta2.testyard.config;

/**
 * Tagged handler incapsulate messages' tag access functionality.
 * <br/>
 * Message tag has type of int. It can be used for correlate request and response messages.
 * Tagged message is a message (request or response) that can hold tag. 
 * User: Inc
 * Date: 18.01.2009
 * Time: 14:30:25
 */
public interface TaggedHandler
{

    /**
     * Check whether message is tagged
     * @param object message for checking
     * @return true if message is tagged
     */
    boolean isTagged(Object object);

    /**
     * Return tag of a message. Message must be tagged.
     * @param object message
     * @return tag of message
     */
    int getTag(Object object);

    /**
     * Set tag on message. Message must be tagged.
     * @param object message
     * @param tag tag to set
     */
    void setTag(Object object, int tag);

}
